
local CommonOHOH = _G.CommonOHOH;
local M = CommonOHOH.class.new(script, CommonOHOH.files.BaseObject());
local ConnectClass = CommonOHOH.load.Connect();
local ISCLient=game:GetService("RunService"):IsClient()

function M.new(self,...)
	return M(self,...);
end;
function M.ctor(self,player,time)
    self.IsClient= ISCLient
	M.super.ctor(self);
    self.DestroyEvent=ConnectClass.new()
    self.player=player
    self.waitTime=time
    self.StartTime=os.time()
    self.WaitConnect=self:AddProcess(function()
        self:Wait(time)
        self:dtor()
    end)
    self:Use()

end;

function M.Use(self)

end

function M.Add(self,t)
    self.waitTime=self.waitTime+t
    if self.WaitConnect then
        self.WaitConnect:Disconnect()
        self.WaitConnect=nil
    end
   local dt= os.time()-self.StartTime
    local hadTime= self.waitTime-dt
    self.WaitConnect=self:AddProcess(function()
        self:Wait(hadTime)
        self:dtor()
    end)
end


function M.dtor(self)
    self.DestroyEvent:Action(self)
    if self.WaitConnect then
        self.WaitConnect:Disconnect()
        self.WaitConnect=nil
    end
	M.super.dtor(self);
end;

return M;
